/*
* Globals.java
* Copyright (C) 2003
* 
* $Id: Globals.java,v 1.5 2005/02/07 17:49:26 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
using System;
using jake2.client;
using jake2.game;
using netadr_t = jake2.qcommon.netadr_t;
using sizebuf_t = jake2.qcommon.sizebuf_t;
using DummyRenderer = jake2.render.DummyRenderer;
using model_t = jake2.render.model_t;
namespace jake2
{
	
	/// <summary> Globals ist the collection of global variables and constants.
	/// It is more elegant to use these vars by inheritance to separate 
	/// it with eclipse refactoring later.
	/// 
	/// As consequence you dont have to touch that much code this time. 
	/// </summary>
	public class Globals:Defines
	{
		public Globals()
		{
			InitBlock();
		}
		private void  InitBlock()
		{
			cl_entities = ;
			cl_parse_entities = ;
		}
		
		public const System.String __DATE__ = "2003";
		
		public const float VERSION = 3.21f;
		
		public const System.String BASEDIRNAME = "baseq2";
		
		/*
		* global variables
		*/
		public static int curtime = 0;
		public static bool cmd_wait;
		
		public static int alias_count;
		public static int c_traces;
		public static int c_brush_traces;
		public static int c_pointcontents;
		public static int server_state;
		
		public static cvar_t cl_add_blend;
		public static cvar_t cl_add_entities;
		public static cvar_t cl_add_lights;
		public static cvar_t cl_add_particles;
		public static cvar_t cl_anglespeedkey;
		public static cvar_t cl_autoskins;
		public static cvar_t cl_footsteps;
		public static cvar_t cl_forwardspeed;
		public static cvar_t cl_gun;
		public static cvar_t cl_maxfps;
		public static cvar_t cl_noskins;
		public static cvar_t cl_pitchspeed;
		public static cvar_t cl_predict;
		public static cvar_t cl_run;
		public static cvar_t cl_sidespeed;
		public static cvar_t cl_stereo;
		public static cvar_t cl_stereo_separation;
		public static cvar_t cl_timedemo = new cvar_t();
		public static cvar_t cl_timeout;
		public static cvar_t cl_upspeed;
		public static cvar_t cl_yawspeed;
		public static cvar_t dedicated;
		public static cvar_t developer;
		public static cvar_t fixedtime;
		public static cvar_t freelook;
		public static cvar_t host_speeds;
		public static cvar_t log_stats;
		public static cvar_t logfile_active;
		public static cvar_t lookspring;
		public static cvar_t lookstrafe;
		public static cvar_t nostdout;
		public static cvar_t sensitivity;
		public static cvar_t showtrace;
		public static cvar_t timescale;
		public static cvar_t in_mouse;
		public static cvar_t in_joystick;
		
		
		public static sizebuf_t net_message = new sizebuf_t();
		
		/*
		=============================================================================
		
		COMMAND BUFFER
		
		=============================================================================
		*/
		
		public static sizebuf_t cmd_text = new sizebuf_t();
		
		public static sbyte[] defer_text_buf = new sbyte[8192];
		
		public static sbyte[] cmd_text_buf = new sbyte[8192];
		public static cmdalias_t cmd_alias;
		
		//=============================================================================
		
		public static sbyte[] net_message_buffer = new sbyte[MAX_MSGLEN];
		
		public static int time_before_game;
		public static int time_after_game;
		public static int time_before_ref;
		public static int time_after_ref;
		
		//UPGRADE_TODO: Class 'java.io.FileWriter' was converted to 'System.IO.StreamWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileWriter'"
		public static System.IO.StreamWriter log_stats_file = null;
		
		public static cvar_t m_pitch;
		public static cvar_t m_yaw;
		public static cvar_t m_forward;
		public static cvar_t m_side;
		
		public static cvar_t cl_lightlevel;
		
		//
		//	   userinfo
		//
		public static cvar_t info_password;
		public static cvar_t info_spectator;
		public static cvar_t name;
		public static cvar_t skin;
		public static cvar_t rate;
		public static cvar_t fov;
		public static cvar_t msg;
		public static cvar_t hand;
		public static cvar_t gender;
		public static cvar_t gender_auto;
		
		public static cvar_t cl_vwep;
		
		public static client_static_t cls = new client_static_t();
		public static client_state_t cl = new client_state_t();
		
		//UPGRADE_NOTE: The initialization of  'cl_entities' was moved to method 'InitBlock'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
		public static centity_t[] cl_entities;
		
		//UPGRADE_NOTE: The initialization of  'cl_parse_entities' was moved to method 'InitBlock'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
		public static entity_state_t[] cl_parse_entities;
		
		public static cvar_t rcon_client_password;
		public static cvar_t rcon_address;
		
		public static cvar_t cl_shownet;
		public static cvar_t cl_showmiss;
		public static cvar_t cl_showclamp;
		
		public static cvar_t cl_paused;
		
		// client/anorms.h
		//UPGRADE_NOTE: Final was removed from the declaration of 'bytedirs'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public static readonly float[][] bytedirs = new float[][]{new float[]{- 0.525731f, 0.000000f, 0.850651f}, new float[]{- 0.442863f, 0.238856f, 0.864188f}, new float[]{- 0.295242f, 0.000000f, 0.955423f}, new float[]{- 0.309017f, 0.500000f, 0.809017f}, new float[]{- 0.162460f, 0.262866f, 0.951056f}, new float[]{0.000000f, 0.000000f, 1.000000f}, new float[]{0.000000f, 0.850651f, 0.525731f}, new float[]{- 0.147621f, 0.716567f, 0.681718f}, new float[]{0.147621f, 0.716567f, 0.681718f}, new float[]{0.000000f, 0.525731f, 0.850651f}, new float[]{0.309017f, 0.500000f, 0.809017f}, new float[]{0.525731f, 0.000000f, 0.850651f}, new float[]{0.295242f, 0.000000f, 0.955423f}, new float[]{0.442863f, 0.238856f, 0.864188f}, new float[]{0.162460f, 0.262866f, 0.951056f}, new float[]{- 0.681718f, 0.147621f, 0.716567f}, new float[]{- 0.809017f, 0.309017f, 0.500000f}, new float[]{- 0.587785f, 0.425325f, 0.688191f}, new float[]{- 0.850651f, 0.525731f, 0.000000f}, new float[]{- 0.864188f, 0.442863f, 0.238856f}, new float[]{- 0.716567f, 0.681718f, 0.147621f}, new float[]{- 0.688191f, 0.587785f, 0.425325f}, new float[]{- 0.500000f, 0.809017f, 0.309017f}, new float[]{- 0.238856f, 0.864188f, 0.442863f}, new float[]{- 0.425325f, 0.688191f, 0.587785f}, new float[]{- 0.716567f, 0.681718f, - 0.147621f}, new float[]{- 0.500000f, 0.809017f, - 0.309017f}, new float[]{- 0.525731f, 0.850651f, 0.000000f}, new float[]{0.000000f, 0.850651f, - 0.525731f}, new float[]{- 0.238856f, 0.864188f, - 0.442863f}, new float[]{0.000000f, 0.955423f, - 0.295242f}, new float[]{- 0.262866f, 0.951056f, - 0.162460f}, new float[]{0.000000f, 1.000000f, 0.000000f}, new float[]{0.000000f, 0.955423f, 0.295242f}, new float[]{- 0.262866f, 0.951056f, 0.162460f}, new float[]{0.238856f, 0.864188f, 0.442863f}, new float[]{0.262866f, 0.951056f, 0.162460f}, new float[]{0.500000f, 0.809017f, 0.309017f}, new float[]{0.238856f, 0.864188f, - 0.442863f}, new float[]{0.262866f, 0.951056f, - 0.162460f}, new float[]{0.500000f, 0.809017f, - 0.309017f}, new float[]{0.850651f, 
			0.525731f, 0.000000f}, new float[]{0.716567f, 0.681718f, 0.147621f}, new float[]{0.716567f, 0.681718f, - 0.147621f}, new float[]{0.525731f, 0.850651f, 0.000000f}, new float[]{0.425325f, 0.688191f, 0.587785f}, new float[]{0.864188f, 0.442863f, 0.238856f}, new float[]{0.688191f, 0.587785f, 0.425325f}, new float[]{0.809017f, 0.309017f, 0.500000f}, new float[]{0.681718f, 0.147621f, 0.716567f}, new float[]{0.587785f, 0.425325f, 0.688191f}, new float[]{0.955423f, 0.295242f, 0.000000f}, new float[]{1.000000f, 0.000000f, 0.000000f}, new float[]{0.951056f, 0.162460f, 0.262866f}, new float[]{0.850651f, - 0.525731f, 0.000000f}, new float[]{0.955423f, - 0.295242f, 0.000000f}, new float[]{0.864188f, - 0.442863f, 0.238856f}, new float[]{0.951056f, - 0.162460f, 0.262866f}, new float[]{0.809017f, - 0.309017f, 0.500000f}, new float[]{0.681718f, - 0.147621f, 0.716567f}, new float[]{0.850651f, 0.000000f, 0.525731f}, new float[]{0.864188f, 0.442863f, - 0.238856f}, new float[]{0.809017f, 0.309017f, - 0.500000f}, new float[]{0.951056f, 0.162460f, - 0.262866f}, new float[]{0.525731f, 0.000000f, - 0.850651f}, new float[]{0.681718f, 0.147621f, - 0.716567f}, new float[]{0.681718f, - 0.147621f, - 0.716567f}, new float[]{0.850651f, 0.000000f, - 0.525731f}, new float[]{0.809017f, - 0.309017f, - 0.500000f}, new float[]{0.864188f, - 0.442863f, - 0.238856f}, new float[]{0.951056f, - 0.162460f, - 0.262866f}, new float[]{0.147621f, 0.716567f, - 0.681718f}, new float[]{0.309017f, 0.500000f, - 0.809017f}, new float[]{0.425325f, 0.688191f, - 0.587785f}, new float[]{0.442863f, 0.238856f, - 0.864188f}, new float[]{0.587785f, 0.425325f, - 0.688191f}, new float[]{0.688191f, 0.587785f, - 0.425325f}, new float[]{- 0.147621f, 0.716567f, - 0.681718f}, new float[]{- 0.309017f, 0.500000f, - 0.809017f}, new float[]{0.000000f, 0.525731f, - 0.850651f}, new float[]{- 0.525731f, 0.000000f, - 0.850651f}, new float[]{- 0.442863f, 0.238856f, - 0.864188f}, new float[]{- 0.295242f, 0.000000f, - 0.955423f}, new float[]{- 0.162460f, 0.262866f, - 0.951056
			f}, new float[]{0.000000f, 0.000000f, - 1.000000f}, new float[]{0.295242f, 0.000000f, - 0.955423f}, new float[]{0.162460f, 0.262866f, - 0.951056f}, new float[]{- 0.442863f, - 0.238856f, - 0.864188f}, new float[]{- 0.309017f, - 0.500000f, - 0.809017f}, new float[]{- 0.162460f, - 0.262866f, - 0.951056f}, new float[]{0.000000f, - 0.850651f, - 0.525731f}, new float[]{- 0.147621f, - 0.716567f, - 0.681718f}, new float[]{0.147621f, - 0.716567f, - 0.681718f}, new float[]{0.000000f, - 0.525731f, - 0.850651f}, new float[]{0.309017f, - 0.500000f, - 0.809017f}, new float[]{0.442863f, - 0.238856f, - 0.864188f}, new float[]{0.162460f, - 0.262866f, - 0.951056f}, new float[]{0.238856f, - 0.864188f, - 0.442863f}, new float[]{0.500000f, - 0.809017f, - 0.309017f}, new float[]{0.425325f, - 0.688191f, - 0.587785f}, new float[]{0.716567f, - 0.681718f, - 0.147621f}, new float[]{0.688191f, - 0.587785f, - 0.425325f}, new float[]{0.587785f, - 0.425325f, - 0.688191f}, new float[]{0.000000f, - 0.955423f, - 0.295242f}, new float[]{0.000000f, - 1.000000f, 0.000000f}, new float[]{0.262866f, - 0.951056f, - 0.162460f}, new float[]{0.000000f, - 0.850651f, 0.525731f}, new float[]{0.000000f, - 0.955423f, 0.295242f}, new float[]{0.238856f, - 0.864188f, 0.442863f}, new float[]{0.262866f, - 0.951056f, 0.162460f}, new float[]{0.500000f, - 0.809017f, 0.309017f}, new float[]{0.716567f, - 0.681718f, 0.147621f}, new float[]{0.525731f, - 0.850651f, 0.000000f}, new float[]{- 0.238856f, - 0.864188f, - 0.442863f}, new float[]{- 0.500000f, - 0.809017f, - 0.309017f}, new float[]{- 0.262866f, - 0.951056f, - 0.162460f}, new float[]{- 0.850651f, - 0.525731f, 0.000000f}, new float[]{- 0.716567f, - 0.681718f, - 0.147621f}, new float[]{- 0.716567f, - 0.681718f, 0.147621f}, new float[]{- 0.525731f, - 0.850651f, 0.000000f}, new float[]{- 0.500000f, - 0.809017f, 0.309017f}, new float[]{- 0.238856f, - 0.864188f, 0.442863f}, new float[]{- 0.262866f, - 0.951056f, 0.162460f}, new float[]{- 0.864188f, - 0.442863f, 0.238856f}, new float[]{- 0.809017f, - 
			0.309017f, 0.500000f}, new float[]{- 0.688191f, - 0.587785f, 0.425325f}, new float[]{- 0.681718f, - 0.147621f, 0.716567f}, new float[]{- 0.442863f, - 0.238856f, 0.864188f}, new float[]{- 0.587785f, - 0.425325f, 0.688191f}, new float[]{- 0.309017f, - 0.500000f, 0.809017f}, new float[]{- 0.147621f, - 0.716567f, 0.681718f}, new float[]{- 0.425325f, - 0.688191f, 0.587785f}, new float[]{- 0.162460f, - 0.262866f, 0.951056f}, new float[]{0.442863f, - 0.238856f, 0.864188f}, new float[]{0.162460f, - 0.262866f, 0.951056f}, new float[]{0.309017f, - 0.500000f, 0.809017f}, new float[]{0.147621f, - 0.716567f, 0.681718f}, new float[]{0.000000f, - 0.525731f, 0.850651f}, new float[]{0.425325f, - 0.688191f, 0.587785f}, new float[]{0.587785f, - 0.425325f, 0.688191f}, new float[]{0.688191f, - 0.587785f, 0.425325f}, new float[]{- 0.955423f, 0.295242f, 0.000000f}, new float[]{- 0.951056f, 0.162460f, 0.262866f}, new float[]{- 1.000000f, 0.000000f, 0.000000f}, new float[]{- 0.850651f, 0.000000f, 0.525731f}, new float[]{- 0.955423f, - 0.295242f, 0.000000f}, new float[]{- 0.951056f, - 0.162460f, 0.262866f}, new float[]{- 0.864188f, 0.442863f, - 0.238856f}, new float[]{- 0.951056f, 0.162460f, - 0.262866f}, new float[]{- 0.809017f, 0.309017f, - 0.500000f}, new float[]{- 0.864188f, - 0.442863f, - 0.238856f}, new float[]{- 0.951056f, - 0.162460f, - 0.262866f}, new float[]{- 0.809017f, - 0.309017f, - 0.500000f}, new float[]{- 0.681718f, 0.147621f, - 0.716567f}, new float[]{- 0.681718f, - 0.147621f, - 0.716567f}, new float[]{- 0.850651f, 0.000000f, - 0.525731f}, new float[]{- 0.688191f, 0.587785f, - 0.425325f}, new float[]{- 0.587785f, 0.425325f, - 0.688191f}, new float[]{- 0.425325f, 0.688191f, - 0.587785f}, new float[]{- 0.425325f, - 0.688191f, - 0.587785f}, new float[]{- 0.587785f, - 0.425325f, - 0.688191f}, new float[]{- 0.688191f, - 0.587785f, - 0.425325f}};
		
		public static bool userinfo_modified = false;
		
		public static cvar_t cvar_vars;
		//UPGRADE_NOTE: Final was removed from the declaration of 'con '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
		public static readonly console_t con = new console_t();
		public static cvar_t con_notifytime;
		public static viddef_t viddef = new viddef_t();
		// Renderer interface used by VID, SCR, ...
		public static refexport_t re = new DummyRenderer();
		
		public static System.String[] keybindings = new System.String[256];
		public static bool[] keydown = new bool[256];
		public static bool chat_team = false;
		public static System.String chat_buffer = "";
		public static sbyte[][] key_lines = new sbyte[32][];
		public static int key_linepos;
		
		public static int edit_line;
		
		public static cvar_t crosshair;
		public static vrect_t scr_vrect = new vrect_t();
		public static int sys_frame_time;
		public static int chat_bufferlen = 0;
		public static int gun_frame;
		public static model_t gun_model;
		public static netadr_t net_from = new netadr_t();
		
		// logfile
		//UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
		public static System.IO.FileStream logfile = null;
		
		public static float[] vec3_origin = new float[]{0.0f, 0.0f, 0.0f};
		
		public static cvar_t m_filter;
		public static int vidref_val = VIDREF_GL;
		
		public static System.Random rnd = new System.Random();
		static Globals()
		{
			cl_entities = new centity_t[Defines.MAX_EDICTS];
			{
				for (int i = 0; i < cl_entities.Length; i++)
				{
					cl_entities[i] = new centity_t();
				}
			}
			cl_parse_entities = new entity_state_t[Defines.MAX_PARSE_ENTITIES];
			{
				for (int i = 0; i < cl_parse_entities.Length; i++)
				{
					cl_parse_entities[i] = new entity_state_t(null);
				}
			}
			{
				for (int i = 0; i < key_lines.Length; i++)
					key_lines[i] = new sbyte[Defines.MAXCMDLINE];
			}
		}
	}
}